require("G");
cc.Class({
    extends: cc.Component,
    properties: {
        audio: {
            default: [],
            type: cc.AudioClip
        }
    },
    onLoad: function () {
        this.clickSound(), this.winSound(), this.failSound(), this.popSound(), this.tool1Sound(),
            this.tool2Sound(), this.tool3Sound();
    },
    init: function () {
        this.audioArray = [];
        for (var t = 0; t < this.audio.length; t++) {
            var e = wx.createInnerAudioContext();
            e.src = this.audio[t].nativeUrl, e.onPlay(function () {
                console.log("开始播放");
            }), e.onError(function (t) {
                console.log(t.errMsg), console.log(t.errCode);
            }), this.audioArray.push(e);
        }
    },
    clickSound: function () {
        cc.director.on("clickSound", function (t) {
            this.audio && this.play(this.audio[0]);
        }.bind(this));
    },
    winSound: function () {
        cc.director.on("winSound", function (t) {
            this.audio && this.play(this.audio[1]);
        }.bind(this));
    },
    failSound: function () {
        cc.director.on("failSound", function (t) {
            this.audio && this.play(this.audio[2]);
        }.bind(this));
    },
    popSound: function () {
        cc.director.on("popSound", function (t) {
            this.audio && this.play(this.audio[3]);
        }.bind(this));
    },
    tool1Sound: function () {
        var t = this;
        cc.director.on("tool1Sound", function (e) {
            t.audio && t.play(t.audio[4]);
        });
    },
    tool2Sound: function () {
        var t = this;
        cc.director.on("tool2Sound", function (e) {
            t.audio && t.play(t.audio[5]);
        });
    },
    tool3Sound: function () {
        var t = this;
        cc.director.on("tool3Sound", function (e) {
            t.audio && t.play(t.audio[6]);
        });
    },
    play: function (t) {
        var e = cc.audioEngine.play(t, !1, 1);
        cc.audioEngine.setVolume(e, .5);
    }
})